-- ZYC.TJ_DJ definition

CREATE TABLE "ZYC"."TJ_DJ"
(
    "ID" NUMBER(*,0) NOT NULL ENABLE,
    "JH" VARCHAR2(100),
    "IP" VARCHAR2(100),
    "DW" NUMBER(*,0),
    "GX" NUMBER(*,0),
    "ZK" VARCHAR2(100),
    CONSTRAINT "t_djxx_PK" PRIMARY KEY ("ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_DJXX"
  BEFORE INSERT ON "TJ_DJ"
  FOR EACH ROW
BEGIN
SELECT SEQ_DJXX.NEXTVAL
INTO :new.id
FROM DUAL;
END;
/
ALTER
TRIGGER "ZYC"."TRG_DJXX" ENABLE;

CREATE UNIQUE INDEX "ZYC"."t_djxx_PK" ON "ZYC"."TJ_DJ" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";


-- ZYC.TJ_MENU definition

CREATE TABLE "ZYC"."TJ_MENU"
(
    "ID"       NUMBER(38,0) NOT NULL ENABLE,
    "NAME"     VARCHAR2(100) DEFAULT NULL,
    "PATH"     VARCHAR2(100) DEFAULT NULL,
    "PID"      NUMBER(10,0),
    "PAGEFILE" VARCHAR2(100),
    "XH"       NUMBER(*,0),
    PRIMARY KEY ("ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_TJ_MENU"
  BEFORE INSERT ON TJ_MENU
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_MENU.NEXTVAL
INTO :new.id
FROM DUAL;
END;
/
ALTER
TRIGGER "ZYC"."TRG_TJ_MENU" ENABLE;

CREATE UNIQUE INDEX "ZYC"."SYS_C0040404" ON "ZYC"."TJ_MENU" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";


-- ZYC.TJ_ROLE definition

CREATE TABLE "ZYC"."TJ_ROLE"
(
    "ROLE_ID"     NUMBER(38,0) NOT NULL ENABLE,
    "ROLE_NAME"   VARCHAR2(100) NOT NULL ENABLE,
    "DESCRIPTION" VARCHAR2(100) DEFAULT NULL,
    PRIMARY KEY ("ROLE_ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_TJ_ROLE"
  BEFORE INSERT ON TJ_ROLE
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_ROLE.NEXTVAL
INTO :new.role_id
FROM DUAL;
END;

/
ALTER
TRIGGER "ZYC"."TRG_TJ_ROLE" ENABLE;

CREATE UNIQUE INDEX "ZYC"."SYS_C0040395" ON "ZYC"."TJ_ROLE" ("ROLE_ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";


-- ZYC.TJ_DW definition

CREATE TABLE "ZYC"."TJ_DW"
(
    "ID"     NUMBER(*,0) NOT NULL ENABLE,
    "DWNAME" VARCHAR2(100),
    "DWJB"   NUMBER(*,0),
    "PID"    NUMBER(*,0),
    CONSTRAINT "TJ_DW_PK" PRIMARY KEY ("ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

ALTER TABLE "ZYC"."TJ_DW"
    ADD CONSTRAINT "FK_TJ_DW" FOREIGN KEY ("PID")
        REFERENCES "ZYC"."TJ_DW" ("ID") ENABLE;

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_TJ_DW"
  BEFORE INSERT ON TJ_DW
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_DW.NEXTVAL
INTO :new.id
FROM DUAL;
END;

/
ALTER
TRIGGER "ZYC"."TRG_TJ_DW" ENABLE;

CREATE UNIQUE INDEX "ZYC"."TJ_DW_PK" ON "ZYC"."TJ_DW" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";


-- ZYC.TJ_GX definition

CREATE TABLE "ZYC"."TJ_GX"
(
    "ID"   NUMBER(*,0),
    "NAME" VARCHAR2(100),
    "DW"   NUMBER(*,0),
    CONSTRAINT "TJ_GX_PK" PRIMARY KEY ("ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

ALTER TABLE "ZYC"."TJ_GX"
    ADD CONSTRAINT "FK_TJ_GXDW" FOREIGN KEY ("DW")
        REFERENCES "ZYC"."TJ_DW" ("ID") ENABLE;

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_TJ_GX"
  BEFORE INSERT ON TJ_GX
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_GX.NEXTVAL
INTO :new.id
FROM DUAL;
END;

/
ALTER
TRIGGER "ZYC"."TRG_TJ_GX" ENABLE;

CREATE UNIQUE INDEX "ZYC"."TJ_GX_PK" ON "ZYC"."TJ_GX" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";


-- ZYC.TJ_ROLEMENU definition

CREATE TABLE "ZYC"."TJ_ROLEMENU"
(
    "ROLEID" NUMBER NOT NULL ENABLE,
    "MENUID" NUMBER NOT NULL ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

ALTER TABLE "ZYC"."TJ_ROLEMENU"
    ADD CONSTRAINT "FK_TJ_MENU" FOREIGN KEY ("MENUID")
        REFERENCES "ZYC"."TJ_MENU" ("ID") ENABLE;

ALTER TABLE "ZYC"."TJ_ROLEMENU"
    ADD CONSTRAINT "FK_TJ_ROLE" FOREIGN KEY ("ROLEID")
        REFERENCES "ZYC"."TJ_ROLE" ("ROLE_ID") ENABLE;


-- ZYC.TJ_USER definition

CREATE TABLE "ZYC"."TJ_USER"
(
    "ID"       NUMBER(*,0) NOT NULL ENABLE,
    "USERNAME" VARCHAR2(100),
    "PASSWORD" VARCHAR2(100),
    "ROLEID"   NUMBER(*,0),
    CONSTRAINT "TJ_USER_PK" PRIMARY KEY ("ID")
        USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
        STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
        PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "USERS" ENABLE
) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";

ALTER TABLE "ZYC"."TJ_USER"
    ADD CONSTRAINT "FK_TJUSERROLE" FOREIGN KEY ("ROLEID")
        REFERENCES "ZYC"."TJ_ROLE" ("ROLE_ID") ENABLE;

CREATE
OR REPLACE TRIGGER "ZYC"."TRG_TJ_USER"
  BEFORE INSERT ON TJ_USER
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_USER.NEXTVAL
INTO :new.id
FROM DUAL;
END;
/
ALTER
TRIGGER "ZYC"."TRG_TJ_USER" ENABLE;

CREATE UNIQUE INDEX "ZYC"."TJ_USER_PK" ON "ZYC"."TJ_USER" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS";



CREATE SEQUENCE ZYC.SEQ_DJXX INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE ZYC.SEQ_TJ_DW INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE ZYC.SEQ_TJ_GX INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE ZYC.SEQ_TJ_MENU INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE ZYC.SEQ_TJ_ROLE INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE SEQUENCE ZYC.SEQ_TJ_USER INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_TJ_MENU"
  BEFORE INSERT ON TJ_MENU
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_MENU.NEXTVAL
INTO :new.id
FROM DUAL;
END;
CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_TJ_ROLE"
  BEFORE INSERT ON TJ_ROLE
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_ROLE.NEXTVAL
INTO :new.role_id
FROM DUAL;
END;

CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_TJ_USER"
  BEFORE INSERT ON TJ_USER
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_USER.NEXTVAL
INTO :new.id
FROM DUAL;
END;

CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_DJXX"
  BEFORE INSERT ON "TJ_DJ"
  FOR EACH ROW
BEGIN
SELECT SEQ_DJXX.NEXTVAL
INTO :new.id
FROM DUAL;
END;
CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_TJ_DW"
  BEFORE INSERT ON TJ_DW
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_DW.NEXTVAL
INTO :new.id
FROM DUAL;
END;
CREATE
OR REPLACE TRIGGER ZYC."ZYC"."TRG_TJ_GX"
  BEFORE INSERT ON TJ_GX
  FOR EACH ROW
BEGIN
SELECT SEQ_TJ_GX.NEXTVAL
INTO :new.id
FROM DUAL;
END;


create table "TJ_LOG"
(
    "ID"         NUMBER(*,0) NOT NULL ENABLE,
    "USERID"     number(10) not null,
    "IP"         VARCHAR2(100),
    "OPTYPE"     VARCHAR2(100),
    "OPCONTENT"  varchar2(100),
    "CREATEDATE" date not null,
    CONSTRAINT "TJ_LOG_PK" PRIMARY KEY ("ID")
)

CREATE SEQUENCE ZYC.SEQ_TJ_LOG INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;
CREATE
OR REPLACE TRIGGER "TRG_TJ_LOG"
  BEFORE INSERT ON TJ_LOG
  FOR EACH ROW
BEGIN
:new
.id := SEQ_TJ_LOG.NEXTVAL;
END;


create table "TJ_DEV"
(
    "ID"      NUMBER(*,0) NOT NULL ENABLE,
    "NAME"    VARCHAR2(100) not null,
    "IP"      VARCHAR2(100),
    "DEVTYPE" NUMBER(*,0) NOT NULL,
    "DWID" NUMBER(*,0) NOT NULL,
    CONSTRAINT "TJ_DEV_PK" PRIMARY KEY ("ID")
)

CREATE SEQUENCE ZYC.SEQ_TJ_DEV INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE
OR REPLACE TRIGGER "TRG_TJ_DEV"
  BEFORE INSERT ON TJ_DEV
  FOR EACH ROW
BEGIN
    :new.id := SEQ_TJ_DEV.NEXTVAL;
END;


create table "TJ_REG"
(
    "ID"       NUMBER(*,0) NOT NULL ENABLE,
    "NAME"     VARCHAR2(100)        not null,
    "LOCATION" VARCHAR2(100),
    "REGTYPE"  NUMBER(*,0) NOT NULL,
    CONSTRAINT "TJ_REG_PK" PRIMARY KEY ("ID")
)

CREATE SEQUENCE ZYC.SEQ_TJ_REG INCREMENT BY 1 MINVALUE 0 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER;

CREATE
OR REPLACE TRIGGER "TRG_TJ_REG"
  BEFORE INSERT ON TJ_REG
  FOR EACH ROW
BEGIN
    :new.id := SEQ_TJ_REG.NEXTVAL;
END;
